<?php 
	require('Header_iframe.php');
	$fql = 'SELECT affiliations FROM user WHERE uid='.$fb_user.'';
	$affiliations = $facebook->api_client->fql_query($fql);
	$sql = "SELECT realm_name FROM realms";
	$realm_names = $db->Execute($sql);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <title>Google Maps JavaScript API Example</title>
    <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=<?php echo $gmaps_api_key; ?>" type="text/javascript"></script>
    <script type="text/javascript">

    //<![CDATA[	

    function load() {
      if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById("map"));
        map.setCenter(new GLatLng(38.21685663944907, -85.75713157653809), 16);
	map.setMapType(G_HYBRID_MAP);
	map.addControl(new GSmallMapControl());
	
	var encoded_points = "qighFncmjONiEnFj@a@hD}EK";
	var encoded_levels = "PEFEP";
	var loc_ekstrom = new GPolygon.fromEncoded({
 	polylines: [
    	 {points: encoded_points,
    	 levels: encoded_levels,
   	 color: "#0000ff",
     	 opacity: 0.7,
     	 weight: 3,
         numLevels: 18,
         zoomFactor: 2}],
  	 fill: true,
  	 color: "#0000ff",
	 opacity: 0.4,
	 outline: true
	})
	<?php
		$encoded_str_2 = $db->Execute("SELECT realm_loc FROM realms WHERE realm_name='loc_sac'");
	?>
	var encoded_str_2 = <?php echo "\"".$encoded_str_2->fields[0]."\""?>;
	var loc_sac = new GPolygon.fromEncoded({
	  polylines: [
	    {points: encoded_str_2,
	     levels: "PEDDCGEDCP",
	     color: "#f33f00",
	     opacity: 0.7,
	     weight: 3,
	     numLevels: 18,
	     zoomFactor: 2}],
	  fill: true,
	  color: "#f33f00",
	  opacity: 0.4,
	  outline: true
	});

	GEvent.addListener(loc_sac, 'click', function() {
		alert("You clicked on the SAC.");
	});

	GEvent.addListener(loc_ekstrom, 'click', function() {
		alert("You clicked on Ekstrom Library.");
	});
/*	
//	GEvent.addListener(loc_ekstrom, 'mouseover', function(){
		loc_ekstrom.setStrokeStyle(GPolyStyleOptions("#339966",3,1));
		alert("You clicked on Ekstrom Library.");
		
	});
*/
	map.addOverlay(loc_sac);
	map.addOverlay(loc_ekstrom);
      }
    }

    //]]>
    </script>
  </head>
  <body onload="load()" onunload="GUnload()">
      <div id="map" style="width: 500px; height: 300px"></div>
	<?php
	var_dump($affiliations);
	echo $affiliations[0]['affiliations'][0]['name'];
	?>
  </body>
</html>
